<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="<%=basePath%>js/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/vue.min.js"></script>
<link rel="stylesheet" href="<%=basePath%>css/layui/css/layui.css">
<script type="text/javascript"
	src="<%=basePath%>js/stockManage/editReturnApply.js"></script>
<script type="text/javascript" src="<%=basePath%>js/BaseUtile.js"></script>

<title>填写退货申请</title>
</head>
<body style="margin: 2%">
	<div style="text-align: center; font-size: 30px">
		<label>填写退货申请</label>
	</div><hr class="layui-bg-orange">
	<div class="layui-form" style="margin-top: 1%">
		<div>
			<!-- 左边的库存显示    -->
			<div id="stockDiv" style="float: left; width: 19%;">
				<div style="font-size: 25px; text-align: center;">商品</div>
				<div class="layui-input-inline">
					<div style="float: left; width: 70%; margin-top: 1%">
						<input id="inputSearchWords" class="layui-input"
							placeholder="输入商品名称/编码" />
					</div>
					<div style="float: left;; width: 30%">
						<button id="searchStockButton" class="layui-btn layui-btn-fluid">搜索</button>
					</div>
				</div>
				<div style="font-size: 17px">

					<table class="layui-table" lay-skin="line">
						<thead>
							<tr>
								<th style="text-align: center;">商品</th>
								<th style="text-align: center;">库存</th>
								<th style="text-align: center;">单位</th>
							</tr>
						</thead>
						<tr v-for="(item ,index) in items" v-if="item.quantity>0"
							v-on:click="chooseQuantity(item,index)">
							<th style="text-align: center;">{{item.material.materialName}}</th>
							<th style="text-align: center;">{{item.quantity}}</th>
							<th style="text-align: center;">{{item.material.unit.unitName}}</th>
						</tr>

					</table>

				</div>
			</div>
			<!-- 右边的填写退货申请 -->
			<div style="float: left; width: 80%;">
				<div id="supplierDiv" class="layui-inline" style="margin-top: 1%;width: 40%">
					<label class="layui-form-label">供货商</label>
					<div class="layui-input-block">
						<select id="inputSupplier">
							<option v-for="option in options"
								v-bind:value="option.userId">{{option.nickname}}</option>
						</select>
					</div>
				</div>
				<div style="margin-top: 3%;width: 40%">
					<label class="layui-form-label">退货日期</label>
					<div class="layui-input-inline">
						<input id="inputReturnTime" name="returnTime" 
							type="text" class="layui-input" placeholder="年-月-日">
					</div>
				</div>
				<div style="margin-top: 3%;width: 40%">
					<label class="layui-form-label">应结账款</label>
					<div class="layui-input-inline">
						<input id="inputTotalPrice" class="layui-input"
							disabled="disabled" />
					</div>
				</div>
				<div style="margin-top: 3%;width: 40%">
					<label class="layui-form-label">经手员工</label>
					<div class="layui-input-inline">
						<input value="${userInfo.nickname}" class="layui-input" disabled="disabled" />
					</div>
				</div>
			</div>
		</div>
		<hr class="layui-bg-orange">
		<div id="returnMaterialDiv" style="clear: both;">
			<!-- 选择的要退货的商品 -->
			<table class="layui-table">
				<thead>
					<tr>
						<th>序号</th>
						<th>编码</th>
						<th>商品</th>
						<th>数量</th>
						<th>单位</th>
						<th>单价</th>
						<th>总价</th>
						<th>操作</th>
					</tr>
				</thead>
				<tr v-for="(item ,index)  in items">
					<th>{{index+1}}</th>
					<th>{{item.materialId}}</th>
					<th>{{item.materialName}}</th>
					<th>{{item.materialQuantity}}</th>
					<th>{{item.unitName}}</th>
					<th>{{item.materialPrice}}</th>
					<th>{{item.totalPrice}}</th>
					<th><button class="layui-btn layui-btn-sm"
							v-on:click="deleteMaterial(item,index)">删除</button></th>
				</tr>
			</table>
		</div>
		

		<hr class="layui-bg-orange">
		<div>
			<label class="layui-form-label">备注:</label>
			<textarea id="inputRemark" placeholder="请输入备注......" class="layui-textarea"></textarea>
		</div>
		<hr class="layui-bg-orange">
	</div>
	<div style="margin-top: 5%">
		<button id="submitButton" class="layui-btn layui-btn-fluid">提交退货申请</button>
	</div>




	<script type="text/javascript" src="<%=basePath%>css/layui/layui.js"></script>
	<script>
		layui.use('form', function() {

		});

		//时间选择器
		layui.use('laydate', function() {
			var laydate = layui.laydate;
			//墨绿主题
			laydate.render({
				elem : '#inputReturnTime',
				theme : 'molv'
			});
		});
	</script>

</body>
</html>